package com.athuahua.r2dbc.repositories;

import com.athuahua.r2dbc.entity.TAuthor;
import com.athuahua.r2dbc.entity.TBook;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Mono;

/**
 * @Author: huahua
 * @Date: 2024/12/3 0003
 * @Time: 15:47
 * @Description:
 */
@Repository
public interface BookRepositories
        extends R2dbcRepository<TBook,Long> {


    @Query("select b.*, ta.name as name from t_book b " +
            "LEFT JOIN test.t_author ta on b.author_id = ta.id " +
            "where b.id = ?")
    Mono<TBook> MyfindBookAndAuthor(Long bookId);

}
